package book;

public class BookList {
    //定义常量
    private static final int DEFAULT_SIZE = 20;
    //创建一个Book类型的数组，books里面存放的是多个book类型实例化的对象
    private Book[] books = new Book[DEFAULT_SIZE];
    //记录当前books数组当中 有多少本书？
    private int usedSize;
    public BookList() {
        books[0] = new Book("剑来","烽火戏诸侯",88,"修仙小说") ;
        books[1] = new Book("雪中悍刀行","烽火戏诸侯",66,"武侠小说");
        books[2] = new Book("流浪地球","刘慈欣",99,"科幻小说");
        books[3] = new Book("木苏里","某某",88,"爱情小说") ;
        books[4] = new Book("天官赐福","墨香铜臭",66,"爱情小说");
        books[5] = new Book("镇魂","priest",99,"爱情小说");
        //表示最初是三本
        this.usedSize = 6;
    }
    //读取这一本书
    public Book getBooK(int pos) {
        return this.books[pos];
    }
    //将该书写入该下标对应的位置
    public void setBook(Book book) {
        this.books[usedSize] = book;
    }
    //后面会用于读取图书
    public int getUsedSize() {
        return usedSize;
    }
    //用于写入图书
    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }
}
